﻿using VisualWip.PresentationModel;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Globalization;

namespace PresnetationModelTests
{


    [TestClass()]
    public class AgeInMinutesConverterTest
    {


        private TestContext testContextInstance;

        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        [TestMethod()]
        public void Given_2_MinutesOldDate_And_AgeCutoffIs_1_Should_Return_True()
        {
            var target = new AgeInMinutesConverter(); 
            var values = DateTime.Now.AddMinutes(-2);
            Type targetType = null;
            var parameter = "1";
            CultureInfo culture = null;
            
            var actual = (bool)target.Convert(values, targetType, parameter, culture);
            
            Assert.IsTrue(actual);
        }

        [TestMethod()]
        public void Given_1_MinutesOldDate_And_AgeCutoffIs_2_Should_Return_False()
        {
            var target = new AgeInMinutesConverter();
            var values = DateTime.Now.AddMinutes(-1);
            Type targetType = null;
            var parameter = "2";
            CultureInfo culture = null;

            var actual = (bool)target.Convert(values, targetType, parameter, culture);
            
            Assert.IsFalse(actual);
        }
    }
}
